'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);
  router.post('/login',controller.login.login); //用户登录
  router.resources('user','/user',controller.user); //用户查询、创建和修改
  router.post('/upload/:id',app.middleware.checkLogin(),controller.upload.upload); //用户上传图片
  router.resources('cart','/cart',app.middleware.checkLogin(),controller.cart); //将购物车中商品加入数据库
};
